{% load i18n %}
{% load pybb_tags %}

<div class="post-details post-{% cycle 'odd' 'even' %}" id="post-{{ post.id }}">
    <a name="post-{{ post.id }}"></a>
    <div class="info">
        <div class="inner">
            <div class="avatar">
                <a href="{{ post.user.pybb_profile.get_absolute_url }}">
                <img src="/glue/avatar/{{post.user}}/" alt="" />
                </a>
            </div>
            <div class="author">{{ post.user|pybb_profile_link }}</div>
            {% if user.is_superuser %}
                <div class="updated">{{ post.user_ip }}</div>
            {% endif %}
            <div class="bottom">
                <a class="permalink" href="{{ post.get_absolute_url }}">#</a>
                <span class="updated">{% pybb_time post.created %}</span>
            </div>

            {% if post.user.pybb_profile.ban_status %}
                <div{% if post.user.pybb_profile.is_banned %}
                title="{% trans 'Expire' %} {{ post.user.pybb_profile.ban_till }}"{% endif %}
                class="banned">
                    {{ post.user.pybb_profile.get_ban_status_display }}
                </div>
            {% endif %}

            <div class="post-controls">
                {% if moderator or post|pybb_posted_by:user %}
                <a href="{% url pybb_post_edit post.id %}">{% trans "Edit" %}</a>
                {% endif %}
                {% if moderator or post|pybb_equal_to:last_post %}
                {% if moderator or post.user|pybb_equal_to:user %}
                / <a onclick="pybb_delete_post('{% url pybb_post_delete post.id %}',
                    'post-{{ post.id }}', '{% trans 'Delete post?' %}'); return false;"
                    href="{% url pybb_post_delete post.id %}">{% trans "Delete" %}</a>
                {% endif %}
                {% endif %}
            </div>
        </div>
    </div>
    <div class="content">
        <div class="inner">
            <!-- Post's content -->
            {% pybb_render_post post %}

            <!-- Last modification date -->
            {% if post.updated %}
            <div class="update-date">{% trans "Edited" %} {% pybb_time post.updated %}</div>
            {% endif %}

            <!-- Attachments -->
            {% if post.attachment_cache %}
            {% for attach in post.attachment_cache %}
            <br/>
            {% trans "Attachment" %}: <a href="{{ attach.get_absolute_url }}">{{ attach.name }}</a> ({{ attach.size_display }})
            {% endfor %}
            {% endif %}

            <!-- Signature -->
            {% if not user.is_authenticated or user.pybb_profile.show_signatures %}
            {% if post.user.pybb_profile.signature %}
            <div class="signature">
                <hr/>
                {{ post.user.pybb_profile.signature_html|safe }}
            </div>
            {% endif %}
            {% endif %}

            <div class="post-related">
                <a href="{% url pybb_post_add topic.id %}?quote_id={{ post.id }}">{% trans "quote" %}</a>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
